<template>
  <a-modal
    :visible="visible"
    :title="$t('button.showStu')"
    :width="1600"
    :bodyStyle="{
      height: '500px',
      overflow: 'auto'
    }"
    :closable="false"
    okText="提交审核"
    @cancel="() => { $emit('cancel') }"
    @ok="confirm"
  >
    <detail-list :col="3">
      <detail-list-item :term="$t('key.xh')">{{ info.xht }}&nbsp;</detail-list-item>
      <detail-list-item :term="$t('key.name')">{{ info.xsxx.xm }}&nbsp;</detail-list-item>
      <detail-list-item :term="$t('key.yx')">{{ info.xsxx.xjxx.ssyxmc }}&nbsp;</detail-list-item>
      <detail-list-item :term="$t('key.zy')">{{ info.xsxx.xjxx.sszymc }}&nbsp;</detail-list-item>
      <detail-list-item :term="$t('key.rxny')">{{ info.xsxx.xjxx.rxny.split(' ')[0] }}&nbsp;</detail-list-item>
      <detail-list-item :term="$t('key.dsxm')">{{ info.xsxx.xjxx.dsxm }}&nbsp;</detail-list-item>
      <detail-list-item :term="$t('key.pyccmc')">{{ info.xsxx.xjxx.pyccmc }}&nbsp;</detail-list-item>
      <detail-list-item :term="$t('key.xslxfs')">{{ info.xsxx.lxdh }}&nbsp;</detail-list-item>
      <detail-list-item :term="$t('key.birthDate')">{{ info.xsxx.csrq }}&nbsp;</detail-list-item>
      <detail-list-item :term="$t('key.birthPalce')">{{ info.xsxx.csdcdmc }}&nbsp;{{ info.xsxx.csdxqdmc }}&nbsp;</detail-list-item>
      <detail-list-item :term="$t('key.sex')">{{ info.xsxx.xbmc }}&nbsp;</detail-list-item>
      <detail-list-item :term="$t('key.politicalLandscape')">{{ info.xsxx.zzmmmc }}&nbsp;</detail-list-item>
      <detail-list-item :term="$t('key.national')">{{ info.xsxx.mzmc }}&nbsp;</detail-list-item>
      <detail-list-item :term="$t('key.dslxfs')">{{ info.xsxx.xjxx.dslxdh }}&nbsp;</detail-list-item>
      <detail-list-item :term="$t('key.xmmc')">{{ info.projectName }}&nbsp;</detail-list-item>
      <detail-list-item :term="$t('key.cfDate')">{{ info.cfDate }}&nbsp;</detail-list-item>
      <detail-list-item :term="$t('key.cfd')">{{ info.cfd }}&nbsp;</detail-list-item>
      
    </detail-list>
      <a-row style="padding-bottom:16px" v-if="info.coursewareList && info.coursewareList.length">
        <div class="term" style="color: rgba(0, 0, 0, 0.85)">上传附件:</div>
      <a-upload
        :default-file-list="defaultFileList"
      >
      </a-upload>
      </a-row>
    <template>
        <p style="text-align: center" slot="footer" ><a-button type="primary" @click="() => { $emit('cancel') }">关闭</a-button></p>
    </template>
  </a-modal>

</template>

<script>
    import {STable} from '~'
    import DetailList from '~/tool/DetailList'
    import moment from 'moment'

    const DetailListItem = DetailList.Item

export default {
  props:['visible','info'],
  components: {DetailList, DetailListItem, STable},
  data () {
    return {
      form: this.$form.createForm(this),
     rptInfo: {
      },
      defaultFileList:[],
      type:'',
      tableData: [],
    }
  },
  watch:{
    info(){
      this.info.xsxx.csrq = moment(this.info.xsxx.csrq).format('YYYY-MM-DD')
      this.info.cfDate = moment(this.info.cfDate).format('YYYY-MM-DD')
      if(this.info.coursewareList && this.info.coursewareList.length){
      this.info.coursewareList.map(item =>{
        item.name = item.sourceName
        item.uid = item.id
      })
      this.defaultFileList = this.info.coursewareList
      }
    }
  },
  methods: {
    remove (index) {
      this.tableData.splice(index, 1)
    },
    confirm () {
      this.form.validateFields((err, values) => {
        if (err) return
        let params = Object.assign({
          id: this.info.id,
          yxsh:this.info.xsxx.xjxx.ssyxm
        }, values)
        this.$api.student.projectSh(params).then(res => {
          this.$message.success(res.msg)
          this.form.resetFields()
          this.$emit('cancel')
          this.$emit('refresh')
        })
      })
    }
  }
}
</script>

<style>

</style>
